package main

import (
	"fmt"
	"github.com/gin-gonic/gin"
	"log"
)

func main() {
	engine := gin.Default()

	engine.POST("/register", func(context *gin.Context) {

		fmt.Println(context.FullPath())

		var register Register
		if err := context.ShouldBind(&register); err != nil{
			log.Fatal(err.Error())
			return
		}

		fmt.Println(register.UserName)
		fmt.Println(register.Phone)

		context.Writer.Write([]byte(register.UserName + " Register"))
	})

	engine.Run()
}

type  Register struct {
	UserName string `form:"name"`
	Password string `form:'password'`
	Phone string	`form:"phone"`
}
